IDIOT COMPILER TUTORIAL (NON PARSER - REGULAR MODE) rev c
NASPITE LABS (c) 2018


Here is a small tutorial to help you figure out the structure of how
to enter in your AppleSOFT code statements. Once you do these three
small programs, you will be set on how to do almost anything inside
of IDIOT Compiler!  You can always read the MANUAL for more indepth
tip/tricks and procedures and some minor quirks.

	A.  test programs	#1. hello world
				#2. color cross
				#3. let a number be

	B.  after the samples

=============================================================
**  PROGRAM 1.  (hello world!)

Boot up the compiler diskette.
Once you see a prompt (BASIC LINE#:) type RESET and (Y).
It is required to RESET your disk every time a new project
is started.  Not doing so will start adding and replacing
program lines of the last program, and they will merge
together, creating a very bad mixture of two programs.

It is now resetting the compiler's code lines, variables and loops.
You will see a prompt, FOR/NEXT LOOP DEPTH.
This is allocating the FOR/NEXT Loop structure, you can type (1) here.

Once you arrive back at (BASIC LINE#:) do the follow to match and
create the simple program...

	10 HOME:
	20 VTAB 12:HTAB 10:
	30 PRINT "HELLO WORLD!":END

1.  TYPE (10)
		THIS CREATES A NEW LINE NUMBER, SPECIFIED BY
		THE LINE NUMBER YOU GAVE.  LINE NUMBERS CAN
		ALSO BE "NAMES" IN IDIOT COMPILER!  YOU WILL
		ALSO SEE THE CURSER MOVE TO THE LEFT SIDE OF
		THE SCREEN.  WHEN THE CURSER IS ON THE RIGHT,
		IT IS IN "LINE NUMBER" MODE, WHEN THE CURSER
		IS ON THE LEFT SIDE, IT IS IN CODE ENTRY MODE.


2.  TYPE (HOME)
		THIS INSTRUCTION IS CONVERTED INTO MACHINE
		LANGUAGE ON THE RIGHT SIDE OF THE SCREEN AND
		RETURNS YOU BACK TO  [ (LINE.10): COMMAND: ]

		ALSO NOTE, YOU CAN DETERMIN WHICH LINE YOU
		ARE CURRENTLY WORKING ON.

3.  TYPE (END)
		THE (END) INSTRUCTION IN IDIOT COMPILER TELLS
		THE COMPILER TO END THE CURRENT LINE.  EVERY
		LINE, UNLESS THE LAST INSTRUCTION IS A "GOTO"
		OR "RUN" REQUIRES (END).  YOU WILL THEN SEE A
		SUMMARY OF ALL THE CODE FOR THAT PARTICULAR
		LINE DISPLAYED ON THE LEFT HAND SIDE, THEN
		RETURNED AGAIN TO (BASIC LINE #) PROMPT

	***side note****
		IF YOU MAKE A MISTAKE IN A PARTICULAR LINE,
		TYPE IN (CANCEL).  IT WILL BE FOLLOWED BY
		(*** LINE.XYZ REMOVED!) AT WHICH POINT
		WHATEVER CODE YOU ENTERED WILL NO LONGER
		EXIST IN YOUR PROGRAM.  RE-ENTER THE LINE
		NUMBER AND START RETYPING THE LINE AGAIN.

4.  TYPE (20)
		THE COMPILER WILL NOW CREATE A NEW LINE #20

5.  TYPE (VTAB)
		YOU ARE ENTERING IN THE COMMAND (VTAB).
		DO *NOT* ENTER IN THE REMAINING PARAMETERS,
		SUCH AS (VTAB 12) ALL IN THE SAME INSTRUCTION.

6.  YOU ARE NOW SEEING...
	[  (VAR OR #XX)  VTAB: ]
	
		HERE YOU ENTER (12)

		*AGAIN YOU WILL SEE ASSEMBLY CODE TRANSLATION
		OF THE INSTRUCTION ON THE RIGHT HAND SIDE.
		YOU CAN NOW CONTINUE TO ENTER MORE CODE
		THAT WILL APPEAR ON THE SAME LINE.

		*PLEASE NOTE THAT EACH PART OF THE INSTRUCTION
		IS ENTERED IN SEPEREATELY AND NOT COMBINED
		AS IN NORMAL APPLESOFT ENTRY.

7 TYPE (HTAB)
	DISPLAYS...[ (VAR OR #XX) HTAB:  ]

8 TYPE (10)
	DISPLAYS ASSEMBLY CODE TRANSLATION

9 TYPE (END)
	ENDS CURRENT LINE NUMBER 20, DISPLAYS ENTIRE CODE LINE
	AND RETURNS TO (BASIC LINE #:)

10 TYPE (30)
	CREATES NEW LINE NUMBER #30, GOES INTO CODE ENTRY MODE.

11 TYPE (PRINT)
	YOU WILL SEE A PROMPT FOR (1. STRING / 2. VARIABLE)
		OPTION 1 IS TO DISPLAY TEXT ENTRY
		OPTION 2 IS TO DISPLAY VARIABLE VALUES

12 TYPE (1)

13 TYPE (HELLO WORLD!)
	YOU WILL NOW SEE A PROMPT (ENTER (Y)?)
	THIS IS FOR OPTIONAL CARRIAGE RETURNS, ALLOWING
	FOR THE NEXT 'DISPLAY' TO BE IMMEDIATELY AFTER
	THE LAST PRINTED STATEMENT, OR ON ITS OWN NEW LINE

12 TYPE (Y)
	CODE WILL BE DISPLAYED ON THE RIGHT HAND SIDE.

13 TYPE (END)


	*** THIS CONCLUDES YOUR PROGRAM
		10 HOME
		20 VTAB 12:HTAB 10
		30 PRINT "HELLO WORLD!":END

TYPE (LINES) AND A LIST OF THE CURRENT LINE NUMBERS IN YOUR
PROGRAM SHOULD APPEAR.

	LINES (END) (LINE.0) AND (LINE.999) SHOULD ALWAYS
	APPEAR IN YOUR NEW PROGRAM AS THESE ARE SETUP AND
	EXIT ROUTINES TO MAKE A COMPILED PROGRAM EXECUTE
	CORRECTLY.  YOU SHOULD ALSO SEE
	LINE.10 / LINE.20 / LINE.30 IN THE LIST.
	THESE CONTAIN THE CODE FOR THE "HELLO WORLD" PROGRAM!

IF YOU ARE BACK AT THE (BASIC LINE #) PROMPT
	TYPE IN: (COMPILE)
	AND    : (Y)

YOU WILL NOW SEE A BUNCH OF PROCESSING MUMBO JUMBO.
AS LONG AS IT DOESNT STOP UNTIL YOU SEE THE PROMPT...
***( SAVE PROGRAM AS: ) IT APEARS YOU HAVE ENTERED
THE PROGRAM CORRECTLY AND NO STRUCTURAL ERRORS HAVE
OCCURED. NOW YOU CAN ENTER THE NAME OF THE PROGRAM
YOU WANT IT TO BE CALLED.

**TYPE (HELLO WORLD)

IT WILL THEN FINISH UP THE COMPILE PROCESS AND SPIT
OUT A MACHINE LANGUAGE EQUIV OF THE PROGRAM ON THE DISK.

----LETS TEST IT OUT.
**TYPE (BRUN HELLO WORLD)

THE PROGRAM SHOULD HOME THE SCREEN AND 
PRINT "HELLO WORLD" NEAR THE CENTER!

=============================================================
=============================================================

**  PROGRAM 2.  (lores cross/lines)

OK, you have the gist, we are not going to hold your hand
like we did in program 1.  We only did that to show you
that each PART of a line instruction has to be entered
individually... as a recap a shortend version

	10 HOME:PRINT "HELLO WORLD"

	HOW TO ENTER
		10
		HOME
		PRINT
		***(SELECT STRING OPTION)
		HELLO WORLD
		***(TYPE Y TO ENTER CARRIAGE RETURN)
		END

ALRIGHT... remember for each NEW program, RESET the compiler.


**** ALSO very important, reboot the COMPILER DISK if you are
                     doing multiple programs back to back ******


***** Please reboot the COMPILER DISK, if you are doing both
		    programs at the same time.  ******


You can only reset it if the prompt looks like
		(BASIC LINE:#) 

**Go ahead and type (RESET) and choose (1) for FOR/NEXT DEPTH.
**The compiler is now reset and read for your new program entry.

Here is test program number 2.

	10 HOME:GR
	20 COLOR=2:VLIN 0,39 AT 20
	30 COLOR=13:HLIN 0,39 AT 20:END

TO ENTER LINE 10
	(10)
	(HOME)
	(GR)
	(END)

Lets enter line 20
	(20)
	(COLOR)
SEE HERE IT WILL PROMPT (VAR OR #XX) COLOR (0-15):

THE (VAR OR #XX) will help you determin what available
entry is allowable in each section of the code.
The VAR means you can enter a variable name, like A or B
Variable names can be of almost any length.  You also see
that #XX indicates you can enter a NUMBER/NUMERIC value.

Durring the course of using IDIOT COMPILER, the (VAR or #XX)
prompt MAY change, say (VAR or   ) or  (   or #XX)...
this means that you can ONLY enter a variable or number in
these instances.... if you attempt to enter an incorrect TYPE,
the code may seem to compile but you will most likely end up
with major problems when attempting to compile or execute
the program, resulting in incorrect values/outputs, or it
might even crash the running program.

Lets again enter
	(2)
	(VLIN)
	(0)
	(39)
	(20)
	(END)		-ending LINE.20

As you see, the prompts that show up walks you
thru the commands and parameters as they are required.

Lets continue to LINE 30
	30 COLOR=13:HLIN 0,39 AT 20:END

Enter in....
	(30)
	(COLOR)
	(13)
	(HLIN)
	(0)
	(39)
	(20)
	(END)

Again, a summary of the ASSEMBLY Code translation is
on the left hand side of the screen after the END
statment.  Lets find out if we have all the lines
needed to compile the program...

TYPE (LINES)

	The list should be as follows...
		END
		LINE.0
		LINE.999
		LINE.10
		LINE.20
		LINE.30


If they match, its time to compile the program...
TYPE (COMPILE)

At the save prompt... TYPE  (CROSS)
and wait for it to finish up.


Now all you have to do is TYPE (BRUN CROSS).
If two color lines, one horizontal, one vertical
appears as a CROSS, you have successfully compiled
this program.

=============================================================
=============================================================

**  PROGRAM 3.  (let a number be)


After these two sample programs, you almost have all
you need to start turning APPLESOFT into its machine
language counterpart outperforming the other COMPILERS
and quite nearly creating code just like an assembly pro
whos been at it for years.

Lets understand the (IF) and (LET) statements.

IDIOT COMPILER champions itself as the FASTEST compiler
because it deals with INTERGER numbers only, and it deals
with them DIRECTLY with no intermediary processes.

LET allows a number to be EQUAL to something.
It could be a NUMBER, or a VARIABLE.


	**	REMEMBER TO REBOOT THE COMPILER DISK,
	**	AND THEN TYPE (RESET),
	**	LET THE FOR/NEXT LOOP equal (1).

Lets create one last program.
		
		10  HOME
		20  LET A = 1000
		30  LET B = 20
		40  PRINT A : PRINT  B
		50  LET D = A + B : PRINT D
		60  LET E = A * D : PRINT E

****Remember, you must enter each part of a statement as
				 as a seperate componet. ****

After rebooting, and resetting (if you are doing them back to back)

L.10
TYPE	(10)
	(HOME)
	(END)
L.20
TYPE	(20)
	(LET)	*You will see a BUNCH of LET options.
		 Since the statement we want is
			LET  A = 1000
		 Choose option ( 1. EQUALS )
TYPE	(1)
	(A)
	(1000)	*You should see (CREATED NEW VARIABLE)
		 This create a new variable specified
		 by the name you gave it... aka (A).
TYPE	(END)
	
L.30
TYPE	(30)
	(LET)
	(1)	*LET B = 20
	(B)
	(20)
	(END)


L.40	(40)
TYPE	(PRINT)	*You will see option for STRING/VARIABLE
		 STRING is for displaying TEXT
		 VARIABLE is for displaying values of VARIABLES
	
TYPE
	(2)
	(A)	*variable A
	(Y)	*allows carriage return, by not typing (Y)
		*it will butt up subsequent print statments.
	(PRINT)
	(2)
	(B)	*display value of variable b
	(Y)
	(END)


*AT this point we will take a break.  Type LIST.  You will
see a new unfamilure LINE.24BITPRINT.  This is an external
routine that has been added to the COMPILED code lines to
help along the compiler do 'additional' things that it was
not originally programmed for.  In this instance,
LINE.24BITPRINT will allow a 24bit integer to be printed
to the screen, and will be called when required, lowering
IDIOT COMPILER's dependency on ROMS.  As you convert additional
applesoft programs, other code lines will appear in your LINE-LIST
such as LINE.16BITMULT for example.  Dont mind it, these
routines are here to make IDIOT COMPILER faster and more useful.


We have two more lines to enter....
		50  LET D = A + B : PRINT D
		60  LET E = A * B : PRINT E

L.50
TYPE	(50)
	(LET)
	(2)	*16BIT ADDITION ROUTINE
	(D)	*SEE NEW VARIABLE (D) CREATED HERE!
	(A)
	(B)
	(PRINT)
	(2)	*PRINT ANOTHER VARIABLE TO SREEN (D)
	(D)
	(Y)	*CARRIAGE RETURN
	(END)

L.60
TYPE	(60)
	(LET)
	(4)	*16BIT MULTIPLICATION ROUTINE
	(E)
	(A)
	(B)	*SEE NEW VARIABLE (E) CREATED!
	(PRINT)
	(2)
	(E)	*DISPLAY VALUE OF VARIABLE E
	(Y)
	(END)


It looks like we are finished here...
	TYPE (LINES)

You should see the following...
	LINE.0 / 10 / 20 / 30 / 40 / 50 / 60
	LINE.999 / LINE.16BITMULT / LINE.24BITPRINT


(A breakdown of what they do)
A.  LINE.0 / LINE.999 start and stop the program
	          more cleanly than if they were left out.

B.  LINE.10/20/30/40/50/60 are statements that make up the program.

C.  LINE.16BITMULT / LINE.24BITPRINT
	       Helper routines for multiplication and printing.
	       They are automatically added if support for code
	       that you entered is required for Machine Language conversion.

TYPE (COMPILE) and then (Y)
And at the prompt for saving  (LET)


TYPE (BRUN LET)
your display should read...

	1000
	20
	1020
	20000


To demonstrate that a project is still active, lets
add another 2 lines to the program.
REBOOT THE COMPUTER...but this time 
DO NOT type RESET..... (dont do it!)


Type LINES and you will see all the code is still
on the floppy disk.  Good, lets add two more lines.


NEW LINE-----	70 IF D > 1000 THEN PRINT "YES"

L.70
TYPE	(70)
	(IF)
	(2)  *SELECTING THE OPTION FOR A>B
	(D)
	(1000)  * IF D>1000 THEN
	(PRINT)
	(1)	*CHOOSING (1) THIS TIME WILL ALLOW PRINTING
		 A STRING, INSTEAD OF A VALUE

	(YES)
	(Y)
	(END)


NEW LINE-----	80 IF E < 50000 THEN PRINT "NO"

L.80
TYPE	(80)
	(IF)
	(3)	*SELECTING OPTION A<B
	(E)
	(50000)
	(PRINT)
	(1)
	(NO)
	(Y)
	(END)

CHECK THE (LINES) AND SEE THAT
	LINE.70 AND LINE.80 are now added.

Lets recompile with the (COMPILE) command...
and name it (LET2).

TYPE (BRUN LET2).

This time, you will see a YES and NO on the bottom,
This is because LINE.70 was a conditional IF statement.

	70 IF D > 1000 THEN PRINT "YES"

D here is equal to D = A + B or 1000+20= 1020.

The same is true with line 80

	80 IF E < 50000 THEN PRINT "NO"

E here is equal to E = A * B or 1000*20= 2000.


If the numbers were some other value... it would
be possible for the IF statement to fail, and
not allow the program to display YES or NO,
dropping to the next line... just as in APPLESOFT.


=============================================================
=============================================================

AFTER THE SAMPLES....

This concludes the simple TUTUORIAL for IDIOT COMPILER.

Please remember a few simple rules....

	1.  ALWAYS REBOOT THE COMPILER inbetwen PROJECTS

	2.  TYPE RESET before starting a brand new project.
	    However... you can stop working on a current
	    project, shut down the computer, and then 
	    continue at a later date with no ill effect.

	3.  REMEMBER that each command is seperated into
	    each individual part, do not just type in
	    full statments with paremeters.  It will
	    reject the input.
		
	4.  If you make a mistake upon entering something,
	    most of the time a few ENTER keys will cancel
	    the current INPUT statement, and you can continue
	    with no ILL effects.  If however something does
	    go thru the coding process... 
		TYPE (CANCEL) and it will reject the entire
	    current line, just RETYPE/RESTART that line!

	5.  Take your time entering code.  Although it does
	    walk you thru code entry on most inputs, it however
	    does very little error checking.  One mistake could
	    foul up paremeters and variables later on in the 
	    program, and since its already in psuedo assembly
	    code, tracking down the problem will be incredibly
	    difficult.

	6.  Consult the manual provided, especially if you do
	    not understand FOR/NEXT loops, or attempting at
	    doing the ULTRA-SPEED QUICKIES or trying to use
	    the IF8/IF24 or LET8/LET24 features.  These are
	    primiarly for those people 'in-the-know" and allow
	    even greater compiled code speedups.

	7.  Remember this is a COMPILER, not an interpeter.
	    Attempting to DEBUG a program using this application
	    is not wise.  Before using IDIOT COMPILER, make sure
	    the code is debugged in APPLESOFT first, and then
	    review the code to see if it attempts to do things
	    that this COMPILER can not do.

	A short list of things that should not be attempted...
		NEGATIVE NUMBERS
		NUMBERS GREATER than 16 MILLION
		STRING VARIABLES
		COMPLEX MATH- outside the scope of ADD/SUB/MULT/DIV

=============================================================

	Thank you for looking into IDIOT COMPILER, and we at NASPITE
	hope that it will allow you to achive ASSEMBLY speeds with
	your basic programming.
				-  Tom and the Naspite Crew (C)2018
